package com.mask.cms.controller;


import com.mask.cms.entity.Banner;
import com.mask.cms.service.BannerService;
import com.mask.roll.common.code.ServiceEnums;
import com.mask.roll.common.constant.RollConstants;
import com.mask.roll.common.util.RollResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 前台banner显示
 * </p>
 *
 * @author hx
 */
@RestController
@RequestMapping("/cms/banner/front")
@CrossOrigin
@Api(tags = "前台轮播图管理")
public class BannerFrontController {

    @Autowired
    private BannerService bannerService;

    /**
     * 查询所有banner
     * @return list
     */
    @GetMapping("/get")
    @ApiOperation("获取所有轮播图信息")
    public RollResponse getAllBanner() {
        List<Banner> list = bannerService.selectAllBanner();
        return RollResponse.result(ServiceEnums.CMS_BANNER_GET_SUCCESS.getCode(),
                RollConstants.SUCCESS,ServiceEnums.CMS_BANNER_GET_SUCCESS.getMessage(),list);
    }
}

